<extend name="Base/common"/>
<block name="header">
    <include file="Public/nav"/>
</block>
<block name="body">
    <eq name="can_manage" value="1">
        <!--如果允许管理-->
        <div id="frm-post-popup" class="white-popup mfp-hide" style="position: relative">

            <h2>选择商品添加</h2>

            <div class="aline" style="margin-bottom: 10px"></div>
            <div style="margin-bottom: 10px ">选择商品：</div>
            <select id="add_goods_id" data-placeholder="选择推荐的商品" class="chosen-select form-control" tabindex="2"
                    value="33">
                <volist name="goods" id="vo">
                    <option value="{$vo.id}">{$vo.title}</option>
                </volist>
            </select>

            <div class="margin-top-10">
                <button class="btn btn-success btn-block" onclick="add_goods()">+ 添加</button>
            </div>

            <div>
            </div>
            <link href="__ZUI__/lib/chosen/chosen.css" type="text/css" rel="stylesheet"/>
            <script src="__ZUI__/lib/chosen/chosen.js"></script>

            <script>
                $(function () {

                    $('.open-popup-link').magnificPopup({
                        type: 'inline',
                        midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
                        closeOnBgClick: false,
                        callback: function () {
                            if ($.fn.chosen) $('.chosen-select').chosen();
                        }
                    });
                });

                function add_goods() {
                    $('.mfp-close').click();
                    var shop_id = "{$shop.uid}";
                    $.post(U('Appstore/Index/setShopRecommonedGoods'), {
                        id: $('#add_goods_id').val(),
                        shop_id: shop_id
                    }, function (msg) {
                        if (msg.status) {
                            toast.success(msg.info + '页面即将刷新。')
                            setTimeout('location.reload()', 1500)
                        } else {
                            toast.error(msg.info)
                        }

                    }, 'json');
                }
            </script>
        </div>
    </eq>

    <!--

        <link href="__JS__/breakingnews.css" type="text/css" rel="stylesheet">-->
    <link href="__JS__/datouwang.css" type="text/css" rel="stylesheet">
    <script src="__JS__/masonary.js"></script>
    <script src="__JS__/imageloaded.js"></script>
    <!--推荐模板部分-->
    <div style="position: relative;height: 130px;margin-top: 90px;background: white;margin-bottom: 10px">
        <div style="position: absolute;left: 50px;;top: -90px; text-align: center">
            <img style="width: 180px;height: 180px;border: 1px solid #eee" src="{$shop.logo|thumb=180,180}"/>

            <div class="margin-top-5">
                <php>for($i=0;$i<$shop['star'];$i++){</php>
                <img src="__IMG__/star-on.png"/>
                <php>}</php>
            </div>

        </div>
        <div style="margin-left: 250px;padding-top:5px;position: relative">
            <h3 style="margin-top: 10px"><strong>{$shop.title}</strong>
                <eq name="shop.official" value="1">
                    <img title="官方认证店" alt="官方认证店" src="__IMG__/icon-official.png"/>
                </eq>
                <eq name="shop.gold" value="1">
                    <img title="金牌店铺" alt="金牌店铺" src="__IMG__/icon-gold.png"/>
                </eq>
                <sub>{$shop.user.space_link}</sub></h3>

            <p>{$shop.ad}</p>

            <p class="evaluation">
                店铺评定：<span class="text-muted">{$shop.evaluation|default='暂未评定'}</span>
            </p>

            <div>

            </div>
            <div class=""
                 style="margin-top: 10px;margin-bottom: 10px;position: absolute;right: 10px;top: 20px;width: 250px">
                <form action="__SELF__" method="post">
                    <div class="search_input">
                        <div class="input-group">

                            <input name="keywords" type="text" class="form-control" placeholder="输入商品名称"
                                   value="{$keywords}">
      <span class="input-group-btn">
        <button class="btn btn-default" type="submit">搜索</button>
      </span>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <if condition="empty($recommond_goods) AND  ($can_manage eq 0)">
        <else/>
        <div class="common-block margin-bottom-15 recom ">
            <header>
                店主推荐
                <div class="fr" style="margin-top: -13px;">
                    <ul id="tabT04" class="tab-T-3 mt20 clearfix">
                        <li class="cur"></li>
                        <li></li>
                    </ul>
                </div>
            </header>

            <section>
                <div class="rowE">
                    <div class="bd ">
                        <div id="sca1" class="warp-pic-list">
                            <div id="wrapBox1" class="wrapBox">
                                <ul id="recommond_goods" class="count clearfix">
                                    <volist name="recommond_goods" id="vo">
                                        <li>
                                            <a href="{:U('pluginDetail',array('id'=>$vo['id']))}" class="img_wrap">{$vo.cover|display_cover=168,168}</a>

                                            <div class="text-area">
                                                <p class="text-ellipsis"><a
                                                        href="{:U('pluginDetail',array('id'=>$vo['id']))}">{$vo.title}</a>
                                                </p>

                                                <p class="text-muted text-ellipsis">
                                                    <empty name="vo.author">
                                                        <a
                                                                href="{$vo.user.space_url}">{$vo.user.nickname}</a>
                                                        <else/>
                                                        {$vo.author}
                                                    </empty>
                                                </p>

                                                <p style="height: 20px">{$vo.versions.0.id|display_fee_tiny}</p>
                                            </div>
                                        </li>
                                    </volist>
                                    <eq name="can_manage" value="1">
                                        <li>
                                            <a href="#frm-post-popup" class="open-popup-link">
                                                <div class="img_wrap"
                                                     style="height:165px;background: #333;color:white;font-size: 120px;text-align: center;line-height:140px">
                                                    +
                                                </div>
                                                <div class="text-area"
                                                     style="  height: 100px;  line-height: 59px;  font-size: 32px;  color: #666;text-align: center;padding-left: 0 ">
                                                    添加商品
                                                </div>
                                            </a>
                                        </li>
                                    </eq>
                                </ul>
                            </div>
                            <a id="right1" class="prev icon btn-recom"></a>
                            <a id="left1" class="next icon btn-recom"></a>
                        </div>
                    </div>
                </div>
            </section>
            <script>

                $(document).ready(function () {

                    $("#recommond_goods").dayuwscroll({
                        parent_ele: '#wrapBox1',
                        list_btn: '#tabT04',
                        pre_btn: '#left1',
                        next_btn: '#right1',
                        path: 'left',
                        auto: true,
                        time: 3000,
                        num: 6,
                        gd_num: 6,
                        waite_time: 1000
                    });

                });
            </script>

        </div>

    </if>


    <empty name="plugins">
        <else/>
        <div class="container common-block templet">
            <header>
                插件
            </header>
            <section>
                <div class="row">


                    <ul class="clearfix goods-list">
                        <volist name="plugins" id="vo">

                            <li style="">
                                <div class="clearfix">
                                    <div style="width: 110px;float: left"><a
                                            href="{:U('pluginDetail',array('id'=>$vo['id']))}"
                                            class="app_icon"><b></b>
                                        {$vo.cover|display_cover}

                                    </a></div>
                                    <div class="col-xs-3" style="width:350px;">
                                        <h3 class="margin-top-0"><a href="{:U('pluginDetail',array('id'=>$vo['id']))}">{$vo.title}</a>
                                            {$vo.latest_version|display_version=true}
                                        </h3>

                                        <p class="ad text-muted">
                                            {$vo.ad|default='暂无商品介绍。'}</p>


                                        <p class="text-muted"> 服务商：{$vo.id|display_shop}
                                            <!-- 更新：{$vo.update_time|friendlyDate}    &nbsp;&nbsp;&nbsp;     发布：{$vo.create_time|friendlyDate}-->
                                        </p>
                                    </div>
                                    <div class="col-xs-3 " style="width: 300px;position: relative">
                                        &nbsp;
                                        <div class="price_area" style="">
                                            <div class="inner-content">{$vo.versions.0.id|display_fee_detail}</div>
                                        </div>
                                    </div>
                                    <div class="col-xs-4" style="width: 250px">
                                        <table class="text-center data-cols">
                                            <tr>
                                                <td>销量<br/><span class="text-danger">{$vo.sales}</span></td>
                                                <td>订阅<br/><span class="text-success">{$vo.watch_count}</span></td>
                                                <td>下载<br/><span class="count">{$vo.total_download_count|display_download_times}</span>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>

                            </li>

                        </volist>
                    </ul>


                    <!-- 插件列表部分-->
                </div>
            </section>


        </div>
    </empty>
    <empty name="modules">
        <else/>
        <div class="container common-block templet margin-top-15">
            <header>
                模块
            </header>
            <section>
                <div class="row">

                    <ul class="clearfix goods-list">
                        <volist name="modules" id="vo">

                            <li style="">
                                <div class="clearfix">
                                    <div style="width: 110px;float: left"><a
                                            href="{:U('pluginDetail',array('id'=>$vo['id']))}"
                                            class="app_icon"><b></b>
                                        {$vo.cover|display_cover}

                                    </a></div>
                                    <div class="col-xs-3" style="width:350px;">
                                        <h3 class="margin-top-0"><a href="{:U('pluginDetail',array('id'=>$vo['id']))}">{$vo.title}</a>
                                            {$vo.latest_version|display_version=true}
                                        </h3>

                                        <p class="ad text-muted">
                                            {$vo.ad|default='暂无商品介绍。'}</p>


                                        <p class="text-muted">  服务商：{$vo.id|display_shop}
                                            <!-- 更新：{$vo.update_time|friendlyDate}    &nbsp;&nbsp;&nbsp;     发布：{$vo.create_time|friendlyDate}-->
                                        </p>
                                    </div>
                                    <div class="col-xs-3 " style="width: 300px;position: relative">
                                        &nbsp;
                                        <div class="price_area" style="">
                                            <div class="inner-content">{$vo.versions.0.id|display_fee_detail}</div>
                                        </div>
                                    </div>
                                    <div class="col-xs-4" style="width: 250px">
                                        <table class="text-center data-cols">
                                            <tr>
                                                <td>销量<br/><span class="text-danger">{$vo.sales}</span></td>
                                                <td>订阅<br/><span class="text-success">{$vo.watch_count}</span></td>
                                                <td>下载<br/><span class="count">{$vo.total_download_count|display_download_times}</span>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>

                            </li>

                        </volist>
                    </ul>


                    <!-- 插件列表部分-->

                </div>
            </section>


        </div>
    </empty>

    <empty name="themes">
        <else/>
        <div class="container common-block templet margin-top-15 " style="margin-bottom: -15px">
            <header>
                主题
            </header>
        </div>
        <!-- 插件列表部分-->


        <div class="row margin-top-15 templates-list" style="position: relative">
            <volist name="themes" id="vo">

                <div class="box" style="display: inline-block;margin: 10px;background: white">
                    <div>
                        <div class="card" style="overflow: visible;margin-bottom: 0">
                            <div class="media-wrapper">
                                <a data-role="use_this" data-value="Blue"
                                   href="{:U('themeDetail',array('id'=>$vo['id']))}">
                                    <img src="{$vo.cover|getThumbImageById=558,auto}">
                                </a>
                            </div>
                            <span class="caption">{$vo.etitle}</span>

                            <div class="card-heading">
                        <span class="pull-right">
                            {$vo.versions.0.id|display_fee}
                        </span>
                                <a href="{:U('themeDetail',array('id'=>$vo['id']))}"
                                   title="查看该主题">
                                    <strong>{$vo.title}</strong>
                                </a>
                            </div>

                            <div class="card-content text-muted">
                                <p class="">
                                    下载：{$vo.total_download_count|display_download_times}&nbsp;&nbsp; 销量： <span
                                        class="text-danger">{$vo.sales}</span>&nbsp;&nbsp; 订阅： <span
                                        class="text-success">{$vo.watch_count}</span>
                                </p>

                                <div class="clearfix">
                                    <div class="pull-left">
                                        版本： {$vo.latest_version|display_version=false}
                                    </div>
                                    <div class="pull-right">
                                        {$vo.update_time|friendlyDate}
                                    </div>
                                </div>

                            </div>
                            <div class="card-actions">
                                <div class="text-mute">
                                    {$vo.id|display_shop}
                                </div>
                            </div>

                            <!-- <div class="card-actions">
                                 <div class="btn-group">

                                 </div>
                             </div>-->
                        </div>
                    </div>
                </div>

            </volist>
        </div>

        <script>
            imagesLoaded(document.querySelector('.templates-list'), function (instance) {
                $('.templates-list').masonry({
                    itemSelector: '.box', gutterWidth: 20,
                    isAnimated: true
                });
            });

        </script>
    </empty>
    <script src="__JS__/scroll.1.3.js"></script>

    <script>
        $(function () {
            $('.goods-list >li').mouseenter(function () {
                var $this = $(this).find('.price_area');
                if ($this.children('.inner-content').height() > 100) {
                    $this.addClass('price-focus');
                    $this.css('top', (80 - $this.height()) / 2 + 'px');

                }
                $(this).addClass('li-focus')

            })
            $('.goods-list >li').mouseleave(function () {
                var $this = $(this).find('.price_area');
                $this.removeClass('price-focus');
                $this.css('top', 0);
                $(this).removeClass('li-focus')
            })
        })

    </script>

</block>